package com.duguo.dynamicmvc.view.forward;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.duguo.dynamicmvc.model.Model;
import com.duguo.dynamicmvc.support.servlet.RequestHandler;
import com.duguo.dynamicmvc.view.AbstractView;

public class ForwardView extends AbstractView {
	
	private static RequestHandler requestHandler;
	
	public ForwardView(){
	}

	public ForwardView(String viewName){
		setViewName(viewName);
	}
		
    public void render(HttpServletRequest request, HttpServletResponse response, Model model) throws Exception {    	
    	request=new ForwardRequestWrapper(request,model,getViewName());
    	requestHandler.handleRequest(request, response);
    }

	public static void setRequestHandler(RequestHandler controllerHandler) {
		ForwardView.requestHandler = controllerHandler;
	}
    
}
